﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="保护器出库单录入.aspx.cs" Inherits="syc.Fc.保护器出库单录入" %>
<html>
<head>
<title></title>
<style> 
tr{height:34px;}
</style>
</head>
<body>
<script type="text/javascript" language="javascript" src="/common.js"></script>
<form id="form1" runat="server">
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
SelectCommand="select @日期=日期,@分厂ID=生产单位ID,@套数=套数,@件数=件数
,@备注=备注 from 自产保护器判定单 where ID=@ID and 铁质供货商ID=0"

InsertCommand="insert into 自产保护器判定单(产品类别ID,日期,生产单位ID,铁质供货商ID,塑质供货商ID,套数,件数,备注,制票,合格)
values(2,@日期,@分厂ID,0,0,-@套数,-@件数,@备注,@制票,1);select @ID=@@IDENTITY;"

UpdateCommand="update 自产保护器判定单 set 日期=@日期,生产单位ID=@分厂ID
,套数=-@套数,件数=-@件数,制票=@制票,备注=@备注 where ID=@ID"

ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
    onselected="SqlDataSource1_Selected" >
<SelectParameters>
<asp:Parameter Name="ID" DbType="Int32" Size="4" />
<asp:Parameter Name="日期" DbType="Date" Size="3" Direction="Output" />
<asp:Parameter Name="分厂ID" DbType="Int32" Size="4" Direction="Output"/>
<asp:Parameter Name="套数" DbType="Int32" Size="4" Direction="Output" />
<asp:Parameter Name="件数" DbType="Int32" Size="4"  Direction="Output" />
<asp:Parameter Name="备注" DbType="String"  Size="40" Direction="Output"  />
</SelectParameters>
<InsertParameters>
<asp:ControlParameter Name="ID" DbType="Int32" Size="4" Direction="Output" ControlID="BillID" />
<asp:ControlParameter Name="日期" DbType="Date"  Size="3" ControlID="Date1" />
<asp:ControlParameter Name="分厂ID" DbType="Int32" Size="4" ControlID="FenChang" />
<asp:ControlParameter Name="套数" DbType="Int32" Size="4" ControlID="TaoShu" />
<asp:ControlParameter Name="件数" DbType="Int32" Size="4" ControlID="JianShu" />
<asp:Parameter Name="制票" DbType="String"  Size="20" />
<asp:ControlParameter Name="备注" DbType="String"  Size="40" ControlID="BeiZhu" />
</InsertParameters>
<UpdateParameters>
<asp:ControlParameter Name="ID" DbType="Int32" Size="4" ControlID="BillID" />
<asp:ControlParameter Name="日期" DbType="Date"  Size="3" ControlID="Date1" />
<asp:ControlParameter Name="分厂ID" DbType="Int32" Size="4" ControlID="FenChang" />
<asp:ControlParameter Name="套数" DbType="Int32" Size="4" ControlID="TaoShu" />
<asp:ControlParameter Name="件数" DbType="Int32" Size="4" ControlID="JianShu" />
<asp:Parameter Name="制票" DbType="String"  Size="20" />
<asp:ControlParameter Name="备注" DbType="String"  Size="40" ControlID="BeiZhu" />
</UpdateParameters>
</asp:SqlDataSource>

<asp:Label ID="BillID" runat="server" Text="0" Visible="False"></asp:Label>

<div id="wintop" class="wintop" style="display:none;">保护器出库单录出</div>

<asp:Panel ID="Panel1" runat="server" CssClass="panel">
<asp:Button ID="Button_Save" runat="server" Text="保 存" UseSubmitBehavior="false" 
        CssClass="button" onclick="Button_Save_Click"  />

<asp:Button ID="Button_Close" runat="server" Text="关 闭" UseSubmitBehavior="false"  Visible="true"
        CssClass="button" OnClientClick="parent.swin2_close();return false;" />

</asp:Panel>

<asp:Panel ID="Panel2" runat="server" CssClass="panel" HorizontalAlign="Center">

<table border=1 style="border-collapse:separate;font-size:14px;margin-top:7px;margin-bottom:24px;">
<tr>
<td colspan=4 align=center style="font-weight:bold; letter-spacing:10px;font-size:16px;border:none;">保护器出库</td>
</tr>
<tr>
<td align=right width=90>产品类别：</td>
<td width=160>螺纹保护器</td>
<td align=right width=90>规 格：</td>
<td width=160>5 - 1/2"</td>
</tr>
<tr>
<td align=right>接收分厂：</td>
<td><asp:DropDownList ID="FenChang" runat="server" Width="120">
<asp:ListItem Value="1">一分厂</asp:ListItem>
<asp:ListItem Value="2">二分厂</asp:ListItem>
<asp:ListItem Value="5">五分厂</asp:ListItem>
</asp:DropDownList></td>
<td align=right>日 期：</td>
<td><asp:TextBox ID="Date1" runat="server" CssClass="textbox" Width="120"></asp:TextBox><img alt="" src="/Icons/29.png" align="absmiddle" onclick="makecalendar(document.getElementById('Date1').value, document.getElementById('Date1'));" /></td>
</tr>

<tr>
<td align=right>套 数：</td>
<td><asp:TextBox ID="TaoShu" runat="server" CssClass="textbox" Width="120"></asp:TextBox></td>
<td align=right>件 数：</td>
<td><asp:TextBox ID="JianShu" runat="server" CssClass="textbox" Width="120"></asp:TextBox></td>
</tr>

<tr>
<td align=right>备 注：</td>
<td colspan="3"><asp:TextBox ID="BeiZhu" runat="server" CssClass="textbox" Width="378"></asp:TextBox></td>
</tr>

</table>

</asp:Panel>
</form>

<script >
    var notice = '<%=this.Notice %>';
    if (notice!='')
    {
        parent.showmsgbox(notice);
    }
    var textboxs = document.getElementsByTagName("input");
    var i;
    for (i = 0; i < textboxs.length; i++) {
        if (textboxs[i].className == "textbox") {
            //textboxs[i].onchange = function(e) { this.className = "textbox-changed"; };
            textboxs[i].onfocus = function(e) { this.select(); };
        }
        else if (textboxs[i].className == "pageturn" || textboxs[i].className == "intxt1" || textboxs[i].className == "intxt2") {
            textboxs[i].onfocus = function(e) { this.select(); };
        }
    }
    document.onkeydown = function(e) {
        if (!e) e = window.event;
        var tag = e.srcElement;
        if (!tag) tag = e.target;
        if (tag.id == "BeiZhu") return;

        if (tag.tagName == "INPUT" && tag.className == "textbox" || tag.tagName == "SELECT") {
            if (e.keyCode == 13) e.keyCode = 9;
        }
    }

    function makecalendar(d, o) {
        obj = o;
        idate = makedate(d);
        cdate = new Date(idate.getFullYear(), idate.getMonth(), 1);
        ds.style.left = (getObjectLeft(o)-43) + "px";
        ds.style.top = (getObjectTop(o) - 90) + "px";
        ds.style.display = 'block';
        showcalendar();
    }
</script>
</body>
</html>
